package cn.tgq007.ttgenerator.controller;

import cn.tgq007.ttgenerator.entity.RestResult;
import cn.tgq007.ttgenerator.utils.SnowFlake;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/generator")
public class GeneratorController {

    @GetMapping("/code")
    public RestResult<Long> generateId() {
        SnowFlake snowFlake = new SnowFlake(2, 3);
        return new RestResult<>(200, "success", snowFlake.nextId());
    }
}
